<?php

/* RECEIVE VALUE */
$validateValue = $_GET['fieldValue'];
$validateId = $_GET['fieldId'];

/* RETURN VALUE */
$arrayToJs = array();
$arrayToJs[0] = $validateId;

$totalurl = "http://nibble.li/twittertido/web/userValid.php?username=$validateValue";
$total = file_get_contents($totalurl, 0, null, null);

if ($total == 1) {  // validate??
    $arrayToJs[1] = true;   // RETURN TRUE
    echo json_encode($arrayToJs);   // RETURN ARRAY WITH success
} else {
    for ($x = 0; $x < 1000000; $x++) {
        if ($x == 990000) {
            $arrayToJs[1] = false;
            echo json_encode($arrayToJs);  // RETURN ARRAY WITH ERROR
        }
    }
}
?>
